package com.songshuai.webapi.permission.dao;

import com.songshuai.webapi.permission.dto.po.CampusListPojo;
import com.songshuai.webapi.permission.dto.po.DepartmentsanduserPojo;
import com.songshuai.webapi.permission.dto.response.CampusResDto;
import com.songshuai.webapi.permission.dto.response.DepartmentAndUserListResDto;
import com.songshuai.webapi.permission.dto.response.DepartmentChildResDto;
import com.songshuai.webapi.permission.dto.response.DepartmentsListResDto;
import com.songshuai.webapi.permission.model.YxDepartments;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface YxDepartmentsMapper {

    int deleteByPrimaryKey(Integer id);

    int insert(YxDepartments record);

    int insertSelective(YxDepartments record);

    YxDepartments selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(YxDepartments record);

    int updateByPrimaryKey(YxDepartments record);

    /**
     * 获取或有部门
     * @param id
     * @return
     */
    DepartmentsListResDto selectById(Integer id);

    YxDepartments selectByDepartmentId(Integer id);

    /**
     * 获取所有部门以及部门员工
     * @param id
     * @return
     */
    DepartmentAndUserListResDto selectDeptAndUserById(Integer id);

    /**
     * 获取所有部门人数
     * @param id
     * @return
     */
    DepartmentsanduserPojo selectDeptUserNum(Integer id);

    int updateBatch(List<Integer> ids);

    /**
     * 根据当前部门id查询父级部门
     * @param id
     * @return
     */
    DepartmentsListResDto selectParentByChildId(Integer id);

    /**
     * 根据实体查询单条数据
     * @param yxDepartments
     * @return
     */
    YxDepartments selectByEntity(YxDepartments yxDepartments);

    /**
     * 根据实体查询
     * @param yxDepartments
     * @return
     */
    List<YxDepartments> selectByEntityList(YxDepartments yxDepartments);

    /**
     * 根据部门id获取部门信息以及是否有子节点
     * @param id
     * @return
     */
    DepartmentChildResDto selectEntityAndChildNumById(Integer id);

    /**
     * 根据部门id获取子部门集合以及子部门是否有子节点
     * @param id
     * @return
     */
    List<DepartmentChildResDto> selectListAndChildNumById(Integer id);

    /**
     * 获取该部门子集个数
     * @param id
     * @return
     */
    Integer selectChildNumById(Integer id);

    /**
     * 查询当前登录用户所管理的校区
     * @param campusListPojo
     * @return
     */
    List<CampusResDto> queryCampusList(CampusListPojo campusListPojo);

    /**
     * 根据用户id获取用户所在部门
     * @param userId
     * @return
     */
    List<YxDepartments> selectDeptByUserId(@Param("userId")Integer userId);


    /**
     * 根据部门名称获取部门信息
     * @param name  模糊匹配
     * @param num
     * @return
     */
    List<YxDepartments> selectEntityListByName(@Param("name")String name,@Param("num")Integer num);

}